package ZorkObjects;

import java.util.HashMap;

public class Condition
{
    private boolean has;
	//Used for single triggers
	private boolean triggered = false;
    private String owner;
    private String object;
    private String status;

    public Condition(HashMap configMap)
    {
        owner = (String)configMap.remove("owner");
        object = (String)configMap.remove("object");
        status = (String)configMap.remove("status");

        if(configMap.get("has") == null) {
            has = false;
        }
        else if(((String)configMap.get("has")).equals("yes")) {
            has = true;
        } else {
            has = false;
        }
    }

	public void setTriggered() {
		triggered = true;
	}

	public boolean getTriggered() {
		return triggered;
	}

	public boolean getHas() {
		return has;
	}

	public String getObject() {
		return object;
	}

	public String getStatus() {
		return status;
	}

    public String getOwner() {
        return owner;
    }

    public String toString() {
        return String.format("has=%s, owner=%s, object=%s, status=%s",
            has, owner, object, status);
    }
}
